<?php

// 获取订单号
function createOrdersn($user_id,$pre='')
{
    $rand = $user_id < 9999 ? mt_rand(100000, 99999999) : mt_rand(100, 99999);
    $order_sn = date('Ymdhis') . $rand;

    $id = str_pad($user_id, (24 - strlen($order_sn)), '0', STR_PAD_BOTH);

    return $pre.$order_sn . $id;
}

